package com.xxx.meter.ui.info.adapter;

import android.annotation.SuppressLint;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xxx.meter.R;
import com.xxx.meter.model.http.bean.MachineInfoBean;

import java.util.ArrayList;
import java.util.List;

public class InfoParamAdapter extends BaseMultiItemQuickAdapter<MachineInfoBean, BaseViewHolder> {

    public InfoParamAdapter(@Nullable List<MachineInfoBean> data) {
        super(data);
        addItemType(MachineInfoBean.TEXT, R.layout.item_info_param);
        addItemType(MachineInfoBean.SELECT, R.layout.item_info_param);
        addItemType(MachineInfoBean.BACK, R.layout.item_info_back);
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void convert(BaseViewHolder helper, final MachineInfoBean item) {
        switch (item.getItemType()) {
            case MachineInfoBean.TEXT:
                helper.setText(R.id.item_info_param_name, item.getName());
                helper.setText(R.id.item_info_param_text, item.getData() + item.getCompany());
                break;
            case MachineInfoBean.SELECT:
                helper.setText(R.id.item_info_param_name, item.getName());
                helper.setText(R.id.item_info_param_text, item.getData() == 1.0 ? item.getItemoption1() : item.getItemoption2());
                break;
            case MachineInfoBean.BACK:
                helper.setText(R.id.item_info_back_text, item.getName());
                break;
            default:
                helper.setText(R.id.item_info_param_name, item.getName());
                helper.setText(R.id.item_info_param_text, item.getData() + item.getCompany());
                break;
        }
    }
}
